package com.osdp.common.http;

import com.osdp.common.exception.PlatformException;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@UtilityClass // 添加一个私有构造函数，为方法添加static
public class ResultUtils {
    public <T> T getResultData(Result<T> result) {
        if (result == null) {
            throw new IllegalArgumentException("返回数据为空");
        }
        if (result.isSuccess()) {
            return result.getResult();
        }
        log.error("处理失败:{}", result);
        throw new PlatformException(result.getMessage());
    }
}
